﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nature.Numerics;
using Nature.Numerics.Basic;


namespace Nature.Toolkit.GMix
{
    class EnthalpyConservationLawFunction : IFunction
    {
        #region Private Fields
        private CompositionObject m_composition;
        double m_fixedEnthalpy; 
        #endregion

        internal void Configure(CompositionObject composition, double fixedEnthalpy)
        {
            m_composition = composition;
            m_fixedEnthalpy = fixedEnthalpy;
        }

        #region IFunction Members

        public double Compute(double temperature)
        {
            return (m_fixedEnthalpy - m_composition.CalcEnthalpy(temperature));
        }

        #endregion
    }


    class EnthalpyConservationLawSolver : Newton<EnthalpyConservationLawFunction>
    {
        internal EnthalpyConservationLawSolver() 
            : base(new EnthalpyConservationLawFunction())
        {
 
        }       
    }   

}
